<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>MPush Message Sender</title>
</head>
<body>
<form onsubmit="return false;">
    <label>
        notificationId:
        <input type="text" value="1" id="notificationId" required="required" style="width: 100%">
    </label>
    <label>
        userId:
        <input type="text" value="user-0" id="userId" required="required" style="width: 100%">
    </label>
    <label>
        sessionId:
        <input type="text" value="1" id="sessionId" required="required" style="width: 100%">
    </label>
    
     <label>
        sessionName:
        <input type="text" value="test" id="sessionName" required="required" style="width: 100%">
    </label>
    <label>
        ownerID:
        <input type="text" value="chenbinbin" id="ownerID" required="required" style="width: 100%">
    </label>
    <label>
        ownerName:
        <input type="text" value="chenbinbin" id="ownerName" required="required" style="width: 100%">
    </label>
    <label>
        docNo:
        <input type="text" value="" id="docNo" required="required" style="width: 100%">
    </label>
    <label>
        createDate:
        <input type="text" value="2018-08-24 10:10:10" id="createDate" required="required" style="width: 100%">
    </label>
   
    <br/>
   
    <input type="button" value="Send To Client" style="width: 100%" onclick="send()">
</form>
<script type="application/javascript">
    function $(id) {
        return document.getElementById(id);
    }

    function send() {
        var notificationId = $('notificationId').value;
        var userId = $('userId').value;
        var sessionId = $('sessionId').value;
        var sessionName = $('sessionName').value;
        var ownerID = $('ownerID').value;
        var ownerName = $('ownerName').value;
        var docNo = $('docNo').value;
        var createDate = $('createDate').value;

        var xhr = new XMLHttpRequest();
        xhr.open('POST', '/session', true);
        xhr.setRequestHeader("context-type", "application/json; charset=utf-8");
        xhr.onload = function (e) {
            if (this.status == 200) {
                alert(this.response)
            }
        };

        xhr.send(JSON.stringify({
        		notificationId: notificationId,
        		userId: userId,
        		sessionId: sessionId,
        		sessionName: sessionName,
        		ownerID: ownerID,
        		docNo:docNo,
        		createDate: createDate,
        		members: [
        			{
        				id:1,
        				sessionId:sessionId,
        				userId:'chengbinbin',
        				userName:'chenbinbin',
        				delFlag:'0'
        			},
        			{
        				id:2,
        				sessionId:sessionId,
        				userId:'rock',
        				userName:'rock',
        				delFlag:'0'
        			}
        		]
        }));
    }
</script>
</body>
</html>



